In [26]:
from __future__ import print_function
from path import Path
import re
import subprocess

Concatenate movies found in the current directory, and converts them in the process.

For example this dir:
test.1.wmv test.2.wmv test.3.wmv 
freek.1.wmv freek.2.wmv

After running this script, you will have 2 movies 1 called test.mp4, the other freek.mp4.


In [44]:
d = Path('.')
ones = d.files('*1.wmv')
for f in ones:
    base = re.sub('1.wmv$', '', f.name)
    newname = './'+base+'concated.mp4'
    series = [str(s) for s in d.files(base + '*.wmv')]
    series.sort()
    mmcat = ['./mmcat'] + series+ [newname]
    rmc = ['rm', '-f'] + [s for s in series if s.endswith('wmv')]
    print('working on:' + base)
    print()
    if subprocess.call(mmcat) == 0:
        print('{} : succes'.format(newname))
        subprocess.call(rmc)
    else:
        print('{} : failed'.format(newname))


working on:lc02-wmvhi-

./lc02-wmvhi-concated.mp4 : succes
working on:lbgpov13skyler-wmvhi-

./lbgpov13skyler-wmvhi-concated.mp4 : succes
working on:lbgpov21diamond-wmvhi-

./lbgpov21diamond-wmvhi-concated.mp4 : succes
working on:lconboat-wmvhi-

./lconboat-wmvhi-concated.mp4 : succes
working on:lbgpov12dana-wmvhi-

./lbgpov12dana-wmvhi-concated.mp4 : succes

In [ ]: